<html>
<head >
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script >
<script>
var flag=false;
$(function(){
window.onload=function(){ 
var cookies = document.cookie.split("; ");//将获得的所有cookie切割成数组 
	for(var i=0;i<cookies.length;i++)
	{
		if(cookies[i].split('=')[0]=="username"){
			//document.getElementById("username").innerHTML = cookies[i].split('=')[1]+"<br>";
		}
		if(cookies[i].split('=')[0]=="password"){		
			flag = true;
				var args = {"id":location.href.split("=")[1]};
				var url = "readposts.php";
				$.post(url,args,function(msg){
					$("#gethtml").empty();
					$("#gethtml").append(msg);
		        			
		        	})
				//$("#gethtml").append(msg);
				
		}
	}

}	
function checklogin(){
	if(flag==true)
		window.location.href="http://127.0.0.1:5222/post.html";
	else{
		alert("Please sign up in first");
		window.location.href="http://127.0.0.1:5222/login.html";
	}		 
}
$("#replybutton").click(function(){
					var args = {"id":location.href.split("=")[1],
						    "content":$("#reply").val()};
					var url = "reply.php";
					$.post(url,args,function(msg){
						$("#gethtml").append(msg);
				


		        			
		        		})
				})
})

</script>
<body>
<span id="username" ></span><br><br>
<hr>
<div id="gethtml">
</div>
<textarea id="reply" style="font-size: 20px;margin-left:20%;width:80%; height:100px; " id="content" name="content" maxlength=150></textarea><br> 
	<input id="replybutton" style="margin-left:55%" type="button" value="回复" />
</body>
</html>
